<?php

namespace app\admin\model;

use joy\Tree;
use think\Model;

class Menu extends Model
{
    protected $name = 'menu';

    public function getList(array $params = [], bool $tree = false)
    {
        $where = [];
        $data = $this->where($where)->json(['meta'])->select()->toArray();
        if ($tree) {
            $data = Tree::arr2tree($data, 'pid', 'children');
        }
        return $data;
    }
}